﻿using UnityEngine;
using System.Collections;
using PBMessage;
public class PacketHelper
{
    public void SendRegAccount(string account,string nickName,string pwd) 
    {
        CS_RegAccount regAccount = new CS_RegAccount();
        regAccount.Account = account;
        regAccount.NickName = nickName;
        regAccount.Pwd = pwd;
        Game.Net.SendPacket<CS_RegAccount>(regAccount, PBMessageID.CS_RegAccount);//
    }

    public void SendLogin(string account,string pwd) 
    {
        CS_Login login = new CS_Login();
        login.Account = account;
        login.Pwd = pwd;
        login.IsRobot = false;
        Game.Net.SendPacket<CS_Login>(login,PBMessageID.CS_Login);
    }

    public void SendHallTick() 
    {
        CS_HallTick tick = new CS_HallTick();
        tick.ClientTime = System.DateTime.Now.Ticks;
        Game.Net.SendPacket<CS_HallTick>(tick,PBMessageID.CS_HallTick);
    }

    public void SendMatchGame(long userId) 
    {
        CS_MatchGame matchGame = new CS_MatchGame();
        matchGame.UserId = userId;
        Game.Net.SendPacket<CS_MatchGame>(matchGame,PBMessageID.CS_MatchGame);
    }

    public void SendMatchBattle()
    {
        CS_MatchGame matchGame = new CS_MatchGame();
        matchGame.UserId = Game.Model.Get<PlayerModel>().UserId;
        Game.Net.SendPacket<CS_MatchGame>(matchGame, PBMessageID.CS_MatchGame);
    }

    public void SendMatchBattleReady(string Account,
                                     string SelectSpriteID,
                                     string SpriteSkinId,
                                     bool IsReady,
                                     int MapID,
                                     string RoomID)
    {
        CS_SyncReadyPlayerState tick = new CS_SyncReadyPlayerState();
        tick.UserId = Game.Model.Get<PlayerModel>().UserId; 
        tick.SelectSpriteID = SelectSpriteID;
        tick.SpriteSkinId = SpriteSkinId;
        tick.IsReady = IsReady;
        tick.MapID = MapID;
        tick.RoomID = RoomID;
        Game.Net.SendPacket<CS_SyncReadyPlayerState>(tick, PBMessageID.CS_SyncReadyPlayerState);
    }

    public void SendSceneTick() 
    {
        CS_GameSceneTick tick = new CS_GameSceneTick();
        tick.ClientTime = System.DateTime.Now.Ticks;
        Game.Net.SendPacket<CS_GameSceneTick>(tick,PBMessageID.CS_GameSceneTick); 
    }

}
